# 定义一个简单的装饰器
def my_decorator(func):
    def wrapper():
        print("装饰器：函数执行前")
        func()
        print("装饰器：函数执行后")
    return wrapper

# 使用装饰器
@my_decorator
def hello():
    print("Hello World!")

# 调用函数
hello()


def repeat(num_times):
    def decorator(func):
        def wrapper(*args,**kwargs):
            for _ in range(num_times):
                func(*args,**kwargs)
        return wrapper
    return decorator

@repeat(num_times=3)
def greet(name):
    print(f"Hello {name}!")

greet("Alice")


